package cn.getech.data.metadata.handler;

import cn.getech.data.metadata.service.CollectionRegisterService;
import cn.getech.data.metadata.utils.MetadataContextUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 元数据注册
 */
@Slf4j
@Component("registerHandler")
public class RegisterHandler {
    private CollectionRegisterService collectionRegisterService;

    private void initService(){
        this.collectionRegisterService = MetadataContextUtil.getBean("collectionRegisterService");
    }

    /**
     * 数仓原有数据初始化到元数据
     * @param param
     */
    public void init(String param){
        initService();
        collectionRegisterService.init();
    }

    public void register(String param){
        initService();
        collectionRegisterService.register();
    }
}
